package com.sgb.merchant.view.fragment;

import android.text.TextUtils;
import android.view.View;

import androidx.lifecycle.ViewModelProvider;

import com.sgb.link.entity.merchant.IndustryDetailEntity;
import com.sgb.merchant.R;
import com.sgb.merchant.databinding.MerchantFragIndustryRequireBinding;
import com.sgb.merchant.viewmodel.IndustryViewModel;
import com.swgk.core.common.base.BaseFragment;
import com.swgk.core.common.base.BaseViewModel;

/**
 * @author: 王彬臣
 * @date: 2021/10/14
 * @Description: 产业园区详情要求
 */
public class IndustryRequireFragment extends BaseFragment<IndustryViewModel, MerchantFragIndustryRequireBinding> {

    IndustryDetailEntity mEntity;

    public void setEntity(IndustryDetailEntity mEntity) {
        this.mEntity = mEntity;

    }

    @Override
    protected int layoutId() {
        return R.layout.merchant_frag_industry_require;
    }

    @Override
    protected void createViewModel() {
        mViewModel = new ViewModelProvider(this).get(IndustryViewModel.class);
    }

    @Override
    protected void init() {
        if (mEntity != null) {
           refresh(mEntity);
        }

    }
    public void refresh(IndustryDetailEntity mEntity){
        mBinding.setViewModel(mEntity.getParkQualification());
        mBinding.tvType.setText(mEntity.getParkQualification().getQualificationTypes().getConstantValue());
        if(TextUtils.isEmpty(mEntity.getParkQualification().getBusinessScope())){
            mBinding.llScope.setVisibility(View.GONE);
        }else{
            mBinding.llScope.setVisibility(View.VISIBLE);
        }
        if(TextUtils.isEmpty(mEntity.getParkQualification().getCollaboratorQualifications())){
            mBinding.llRequire.setVisibility(View.GONE);
        }else{
            mBinding.llRequire.setVisibility(View.VISIBLE);
        }
    }

    @Override
    public void onClick(View v) {

    }
}
